home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
progjour
/
1991
/
02
/
borland
/
min.c
next >
Wrap
C/C++ Source or Header
|
1990-11-20
|
3KB
|
80 lines
/*-------------------------------------------------------------*\
| MIN.C A Minimum Windows Program that displays a window. |
| The window can be moved, sized, minimized and |
| maximized. The WM_QUIT message is correctly |
| handled so that the program terminates properly. |
\*-------------------------------------------------------------*/
#include <Windows.H>
/*-------------------------------------------------------------*\
| Function Prototypes. |
\*-------------------------------------------------------------*/
long FAR PASCAL MinWndProc (HWND, WORD, WORD, LONG);
/*-------------------------------------------------------------*\
| Main Function: WinMain. |
\*-------------------------------------------------------------*/
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdLine, int cmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if (!hPrevInstance)
{
wndclass.lpszClassName = "MIN:MAIN";
wndclass.hInstance = hInstance;
wndclass.lpfnWndProc = MinWndProc;
wndclass.hCursor = LoadCursor (hInstance, "hand");
wndclass.hIcon = LoadIcon (hInstance,"snapshot");
wndclass.lpszMenuName = NULL;
wndclass.hbrBackground = COLOR_WINDOW+1;
wndclass.style = NULL;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
RegisterClass( &wndclass);
}
hwnd = CreateWindow("MIN:MAIN", /* Class name. */
"Minimum", /* Title. */
WS_OVERLAPPEDWINDOW, /* Style bits. */
CW_USEDEFAULT, /* x - default. */
0, /* y - default. */
CW_USEDEFAULT, /* cx - default. */
0, /* cy - default. */
NULL, /* No parent. */
NULL, /* Class menu. */
hInstance, /* Creator. */
NULL); /* Params. */
ShowWindow (hwnd, cmdShow);
while (GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg); /* Keyboard input. */
DispatchMessage(&msg);
}
return 0;
}
/*-------------------------------------------------------------*\
| Window Procedure: MinWndProc. |
\*-------------------------------------------------------------*/
long FAR PASCAL MinWndProc (HWND hwnd, WORD wMsg,
WORD wParam, LONG lParam)
{
switch (wMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hwnd,wMsg,wParam,lParam));
break;
}
return 0L;
}